package ncsutest;

public class NCSUCalibrationRunner {
	private NCSUCalibrationMonitor monitor;

	public NCSUCalibrationRunner(NCSUCalibrationMonitor monitor) {
		this.monitor = monitor;
	}
	
	public void run(NCSUCalibrationBase calib) throws Exception {
		int[] calibs = calib.calibrationsToRun();
		
		for (int i = 0; i < calibs.length; i++) {
			System.out.println("Performing calibration " + calibs[i]);
			monitor.calibrationStart(calibs[i]);
			performCalibration(calib, calibs[i]);
			monitor.calibrationFinish(calibs[i]);
		}
	}
	
	private void performCalibration(NCSUCalibrationBase calib, int i) throws Exception {
		switch (i) {
		case 0:
			calib.performCalibration00();
			break;
		case 1:
			calib.performCalibration01();
			break;
		case 2:
			calib.performCalibration02();
			break;
		case 3:
			calib.performCalibration03();
			break;
		case 4:
			calib.performCalibration04();
			break;
		case 5:
			calib.performCalibration05();
			break;
		case 6:
			calib.performCalibration06();
			break;
		case 7:
			calib.performCalibration07();
			break;
		case 8:
			calib.performCalibration08();
			break;
		case 9:
			calib.performCalibration09();
			break;
		}
	}
	
}
